package com.test.mchelepesa.dialog_rice;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.test.mchelepesa.R;
import com.test.mchelepesa.util_rice.http_rice.HttpManager_rice;

public class NoticeDialog_rice extends Dialog {

    private final String content;

    public NoticeDialog_rice(@NonNull Context context, String content) {
        super(context);
        this.content = content;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_notice_rice);

        getWindow().setBackgroundDrawableResource(R.color.trans);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

        TextView contentTv = findViewById(R.id.dialog_notice_tv_content);

        if (!TextUtils.isEmpty(content)) contentTv.setText(content);

        findViewById(R.id.dialog_notice_tv_ok).setOnClickListener(view -> {
            HttpManager_rice.getInstance().saveUserBuriedPoint("DIALOG_NOTICE_OK_CLICK");
            dismiss();
        });

    }

}
